package com.gym.code.config.admin.bean;

import com.gym.code.generator.EnumContants.FieldClassType;
import com.gym.code.generator.model.mapping.bean.EnumGenerateModel.EnumScope;

/**
 * 
 * @author xinchun.wang 
   @email: 532002108@qq.com
 * @createTime 2015-5-23 下午8:48:37
 */
public class ColumnMappingBean {
	
	private long id;
	
	private long tableId;
	/**
	 * 成员名字
	 */
	private String propertyName;

	/**
	 * 字段名
	 * */
	private String columnName;

	/** 类型 */
	private FieldClassType valueType;

	private int enumFlag = 0; // 0 :false,1:true

	private String enumTypeName;


	/** 默认值 */
	private String defaultValue;

	private String desc;
	
	private String patternValue;
	
	private EnumScope scope = EnumScope.local; //TODO 待修复

	private boolean nullAble;
	
	public String getPropertyName() {
		return propertyName;
	}

	public void setPropertyName(String propertyName) {
		this.propertyName = propertyName;
	}

	public int getEnumFlag() {
		return enumFlag;
	}
	
	
	public boolean isEnum() {
		return enumFlag == 1;
	}
	
	public String getEnumFlagStr() {
		return enumFlag == 0 ? "NO" :"YES";
	}

	public void setEnumFlag(int enumFlag) {
		this.enumFlag = enumFlag;
	}

	public String getEnumTypeName() {
		return enumTypeName;
	}

	public void setEnumTypeName(String enumTypeName) {
		this.enumTypeName = enumTypeName;
	}


	public String getColumnName() {
		return columnName;
	}

	public void setColumnName(String columnName) {
		this.columnName = columnName;
	}

	public FieldClassType getValueType() {
		return valueType;
	}

	public void setValueType(FieldClassType valueType) {
		this.valueType = valueType;
	}
	
	public void setValueType(String valueType) {
		this.valueType = FieldClassType.instance(valueType);
	}
	
	
	public boolean isBetween() {
		return FieldClassType.isBetweenAble(valueType);
	}
	
	public boolean isList() {
		return FieldClassType.isListAble(valueType);
	}

	public String getDefaultValue() {
		return defaultValue;
	}

	public void setDefaultValue(String defaultValue) {
		this.defaultValue = defaultValue;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}
	

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public long getTableId() {
		return tableId;
	}

	public void setTableId(long tableId) {
		this.tableId = tableId;
	}

	public String getPatternValue() {
		return patternValue;
	}

	public void setPatternValue(String patternValue) {
		this.patternValue = patternValue;
	}

	public EnumScope getScope() {
		return scope;
	}

	public void setScope(EnumScope scope) {
		this.scope = scope;
	}
	
	public void setScope(int scope) {
		this.scope = scope == 1 ? EnumScope.global:EnumScope.local;
	}

	public boolean isNullAble() {
		return nullAble;
	}

	public void setNullAble(boolean nullAble) {
		this.nullAble = nullAble;
	}

	
}
